
import pygame
from pygame.locals import *
pygame.init()

screen = pygame.display.set_mode((1000,457))
pygame.display.set_caption("绘制图片")

# 1.加载图片
bgImg = pygame.image.load("./image/bg2.png")
# user1 = pygame.image.load("./image/user1.png")
# user1 = pygame.image.load("./image/user1.png").convert()  # 加了convert()比不加加载速度会更快
user1 = pygame.image.load("./image/user3.png").convert_alpha() # 加了比不加加载速度会更快
# convert()针对透明图像显示不正常
# 2.渲染图片
screen.blit(bgImg,(0,0))
screen.blit(user1,(500,200))

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            exit()
    pygame.display.update()
